<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul class="ul">
    </ul>
    <script>
        let list = [
            {name: 'apple', price: 3},
            {name: 'banan', price: 2},
            {name: 'orange', price: 4},
            {name: 'tomato', price: 3},
        ]
        let str = '';// 换行时需要用加号连接
        let str2 = `qwerqwerqq
        weqwwedf`;
        for (let i = 0; i < list.length; i++) {
            // str += '<li>name:'+ list[i].name +' ,price:'+ list[i].price +'</li>'
            str += `
                <li>
                    name:${list[i].name}
                    price:${list[i].price}
                </li>
            `
        }
        document.querySelector('.ul').innerHTML = str;
    </script>
</body>
</html>